<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/common/taglibs.jsp" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>帐号管理 - <s:text name="context.title"/></title>
	<%@ include file="/common/meta.jsp" %>
	
	<script>
		$(document).ready(function() {
			//聚焦第一个输入框
			$("#loginName").focus();
			//为inputForm注册validate函数
			$("#inputForm").validate({
				rules: {
					loginName: {
						required: true,
						remote: "user!checkLoginName.action?oldLoginName=" + encodeURIComponent('${loginName}')
					},
					name: "required",
					password: {
						required: true,
						minlength:3
					},
					passwordConfirm: {
						equalTo:"#password"
					},
					email:"email",
					checkedRoleIds:"required"
				},
				messages: {
					loginName: {
						remote: "用户登录名已存在"
					},
					passwordConfirm: {
						equalTo: "输入与上面相同的密码"
					}
				}
			});
		});
	</script>
</head>

<body>
	<h1 class="title01"><img src="${ctx}/images/02_15.gif" width="45" height="42" class="fl"/><a href="#">更多</a><s:if test="id == null">创建</s:if><s:else>修改</s:else>用户 </h1>
	<form id="inputForm" action="user!save.action" method="post">
	<fieldset class="fs_ys">
		<legend><s:if test="id == null">创建</s:if><s:else>修改</s:else>用户 </legend>
	    
	    <p>登录名:<input type="text" name="loginName" class="input_ys1" size="40" id="loginName" value="${loginName}"/></p>
		<p>用户名:<input type="text" id="name" name="name" size="40" class="input_ys1" value="${name}"/></p>
		<p>密码:<input type="password" id="password" name="password" class="input_ys1" size="40" value="${password}"/></p>
		<p>确认密码:<input type="password" id="passwordConfirm" class="input_ys1" name="passwordConfirm" size="40" value="${password}"/></p>
		<p>邮箱:<input type="text" id="email" name="email" class="input_ys1" size="40" value="${email}"/></p>
		<p>角色:<s:checkboxlist name="checkedRoleIds"  list="allRoleList" listKey="id" listValue="name" theme="custom"/></p>
		<p><security:authorize ifAnyGranted="ROLE_修改用户">
						<input class="button" type="submit" value="提交"/>&nbsp;
					</security:authorize>
					<input class="button" type="button" value="返回" onclick="history.back()"/>
		</p>		
	</fieldset>
		<input type="hidden" name="id" value="${id}"/>
	</form>
</body>
</html>
